﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <title>Argox 打印机接口插件</title>
    <object id="ArgoxPrinter" classid="clsid:AEFC7183-44DE-463c-ACEF-8CAF33B96701"codebase="ArgoxWebPrint.cab">
    </object>

    <script type="text/javascript">

        function PrinterSetup() {
            ArgoxPrinter.A_EnumUSB();
            ArgoxPrinter.A_CreateUSBPort(1);
            ArgoxPrinter.A_Set_Unit("n");	//n: 英吋, m:公厘
            ArgoxPrinter.A_Set_Syssetting(2, 0, 0, 0, 0);
            ArgoxPrinter.A_Set_Backfeed(320);		//回退值
            ArgoxPrinter.A_Set_Darkness(8);
            ArgoxPrinter.A_Set_Speed("E");
            ArgoxPrinter.A_Prn_Text_TrueType(40, 20, 30, "宋体", 1, 600, 0, 0, 0, "A1", "Argox 打印机设定完成！", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 40, 30, "宋体", 1, 600, 0, 0, 0, "A2", "单位：吋", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 60, 30, "宋体", 1, 600, 0, 0, 0, "A3", "打印模式：热转印", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 80, 30, "宋体", 1, 600, 0, 0, 0, "A4", "打印机端口：USB", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 100, 30, "宋体", 1, 600, 0, 0, 0, "A5", "打印浓度：8", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 120, 30, "宋体", 1, 600, 0, 0, 0, "A6", "打印速度：3 ips", 1);
            ArgoxPrinter.A_Prn_Text_TrueType(40, 140, 30, "宋体", 1, 600, 0, 0, 0, "A7", "倒退位移：开启 (1吋)", 1);
            ArgoxPrinter.A_Print_Out(1, 1, 1, 1);
            ArgoxPrinter.A_ClosePrn();
        }

        function Print() {
            var Data1 = document.getElementById("data1").value
            var Data2 = document.getElementById("data2").value;
            var volstr = document.getElementById("volume").value;
            var imgdir = document.getElementById("imgdir").value;
            var Address = document.getElementById("txtIP").value;
            if (document.getElementById("r1").checked) {
                ArgoxPrinter.A_EnumUSB();
                ArgoxPrinter.A_CreateUSBPort(1);
            }
            else if (document.getElementById("r2").checked) {
                ArgoxPrinter.A_CreatePort(5, 0, txtip);
            }
            //ArgoxPrinter.A_Draw_Box("A", 10, 10, 340, 120, 3, 3);
            //ArgoxPrinter.A_Draw_Line("A", 15, 40, 340, 3);
            ArgoxPrinter.A_Bar2d_QR(20, 20, 1, '6', 1, 'N', 1, Data1);
            //ArgoxPrinter.A_Bar2d_QR(140, 160, 1, '6', 10, 'N', 1, Data1);
            //ArgoxPrinter.A_Prn_Barcode(20, 30, 1, "E", 2, 6, 40, "B", 1, Data2);
            //ArgoxPrinter.A_Prn_Text_TrueType(50, 90, 35, "宋体", 1, 600, 0, 0, 0, "CC", "固定资产标签", 1);
            //ArgoxPrinter.A_Get_Graphic_ColorBMP(10, 10, 1, "B", imgdir);
            /*
            ArgoxPrinter.A_Draw_Box("A", 10, 10, 390, 140, 3, 3);
            ArgoxPrinter.A_Draw_Line("A", 220, 10, 3, 140);	
            ArgoxPrinter.A_Bar2d_QR(200, 200, 1, '8', 10, 'N', 1, Data1);
            ArgoxPrinter.A_Bar2d_QR(20, 200, 1, '6', 10, 'N', 1, Data1);
            ArgoxPrinter.A_Prn_Barcode(235, 32, 1, "E", 2, 6, 40, "B", 1, Data2);
            ArgoxPrinter.A_Prn_Text_TrueType(280, 110, 35, "宋体", 1, 600, 0, 0, 0, "CC", "固定资产标签", 1);
            ArgoxPrinter.A_Get_Graphic_ColorBMP(14, 40, 1, "B", imgdir);
            */


            ArgoxPrinter.A_Print_Out(1, 1, volstr, 1);
            ArgoxPrinter.A_ClosePrn();
        }

        function PrinterStatus() {
            ArgoxPrinter.A_EnumUSB();
            ArgoxPrinter.A_CreateUSBPort(1);
            var ret = ArgoxPrinter.A_getPrinterStatus();
            if (ret == 0) {
                document.getElementById("status").value = "无返回值";
                return;
            }
            else if (ret == 1) {
                document.getElementById("status").value = "打印机命令解析器忙碌中！";
                return;
            }
            else if (ret == 2) {
                document.getElementById("status").value = "2 纸张用完或安装错误！";          //纸张用完或安装错误！
                return;
            }
            else if (ret == 4) {
                document.getElementById("status").value = "4 碳带用完或安装错误！";                       //碳带用完或安装错误！";
                return;
            }
            else if (ret == 8) {
                document.getElementById("status").value = "8 打印批次文档中！";           //打印批次文档中！";
                return;
            }
            else if (ret == 16) {
                document.getElementById("status").value = "16 正在打印文件！";                 //正在打印文件！
                return;
            }
            else if (ret == 32) {
                document.getElementById("status").value = "32 打印机暂停！";                 //打印机暂停！
                return;
            }
            else if (ret == 64) {
                document.getElementById("status").value = "64 正在送出标签纸！";                 //正在送出标签纸！
                return;
            }
            else if (ret == 9) {
                document.getElementById("status").value = "9 打印机待机中！";                 //打印机待机中！
                return;
            }
            ArgoxPrinter.A_ClosePrn();
        }

    </script>
    
</head>
<body>
    <h1 align="center">Argox 标签打印机Web测试</h1>
    <form id="form1" >
    <div id="one">
        <table width="900">
            <tr>
                <td>
                    注意事项：
                </td>
            </tr>
             <tr>
                <td>
                    1. 本插件适用于Argox PPLA语言条码打印机，使用USB\LAN接口连接电脑。
                </td>
            </tr>
            <tr>
                <td>
                    2. 标签纸尺寸为宽4“（10cm)，高度1.5"（4cm) 以上可打印出完整内容。
                </td>
            </tr>   
            <tr>
                <td>
                    3. 插件安装软件包名称为：ArgoxWebPrintSetup.msi，必须安装在客户端电脑。
                </td>
            </tr>   
            <tr>
                <td>
                    3. 打印机接口函数请参阅：AWIN-CAPI.txt文件，用户可直接在浏览器上编写JS脚本调用。
                </td>
            </tr>   
            <tr>
                <td>
                    4. 动态库请复制到C:\Windows\System32\文件夹下。
                </td>
            </tr>      
             <tr>
                <td>
                    5. 请使用IE浏览器开启网页，并允许此插件运行。
                </td>
            </tr>
            <tr>
                <td>
                    6. 装好碳带及标签纸，按打印机上“FEED”键走纸正常后，点击“开始打印”按钮，打印机即刻打印出条码文字图片（在本例中，图片默认存在本地 C:\logo.bmp。)
                </td>
            </tr>                                            
            <tr>
                <td>
                    7. 点击“开始打印”按钮，打印机即刻打印出条码文字图片（在本例中，默认图片存在本地C:\logo.bmp。
                </td>
            </tr>    
            <tr>
                <td>
                    8. 点击“打印机设置”按钮，即刻对打印机进行设置，并打印出设定参数。
                </td>
            </tr>                      
          </table>
    </div> <br/> 
    
    <div>        
       <table width="900">
            <tr>
              <td align="center">
                 打印接口：
              </td>
             <td>
              <input type="radio" name="radio1" id="r1"/>USB打印
             </td>
             <td>
              <input type="radio" name="radio1" id="r2"/>LAN打印
             </td>
            </tr>
            <tr>
              <td align="center">
               请输入IP地址:
              </td>
              <td align="left" style="width:340px">
               <input type="text" name="txtIP" id="txtIP"/>(LAN打印请填写IP)
              </td>
            </tr>
            <tr>
                <td align="center">
                    条码内容1：
                </td>
                <td>
                    <input type="text" name="data1" id="data1" value="QR Code Data1" />
                </td>
                <td align="center" style="width: 166px">
                    条码内容2：
                </td>
                <td>
                    <input type="text" name="data2" id="data2" value="QR Code Data2" />
                </td>
            </tr>
            <tr>                
                <td align="center">
                    打印份数：
                </td>
	<td>
                     <input type="text" name="volume" id="volume" value="1" />
                </td>
                <td align="center" style="width: 166px">
                    图档位置：
                </td>
                <td style="width: 166px">
                    <input type="text" name="imgdir" id="imgdir" value="C:\\logo.bmp" />
                </td>                
            </tr>                      
            <tr>                
                <td align="center" style="width: 166px">
                    <input type="button"  value="开始打印"  style="width: 95px" onclick="Print()"/>
                </td>
                <td align="left" style="width: 166px">
                    <input type="button" value="打印机设置" style="width: 95px" onclick="PrinterSetup()"/>
                </td>
                <td align="right" style="width: 166px">
                    
                </td>
			<tr>
			<tr>
				<td align="center" style="width: 166px">
                    打印机状态查询：
                </td>
				<td align="left" style="width: 166px">
                    <input type="button"  value="开始查询"  style="width: 95px" onclick="PrinterStatus()"/>
                </td>
			</tr>	
			</tr>
			<tr>
			
				<td align="center" style="width: 166px">
                    打印机状态：
                </td>
                <td>
                    <input type="text" name="status" id="status" readonly="readonly" />
                </td>
            </tr>
                <td align="right" >
                    
                </td>
            </tr>                      
        </table><br />       
        
    </div>
    </form>
</body>
</html>

